Rely-Guarantee References for Refinement Types
نویسندگان
چکیده
Reasoning about side effects and aliasing is the heart of verifyingimperative programs. Unrestricted side effects through one refer-ence can invalidate assumptions about an alias. We present a newtype system approach to reasoning about safe assumptions in thepresence of aliasing and side effects, unifying ideas from referenceimmutability type systems and rely-guarantee program logics. Ourapproach, rely-guarantee references, treats multiple references toshared objects similarly to multiple threads in rely-guarantee pro-gram logics. We propose statically associating rely and guaranteeconditions with individual references to shared objects. Multiplealiases to a given object may coexist only if the guarantee conditionof each alias implies the rely condition for all other aliases. Wedemonstrate that existing reference immutability type systems arespecial cases of rely-guarantee references.In addition to allowing precise control over state modification,rely-guarantee references allow types to depend on mutable datawhile still permitting flexible aliasing. Dependent types whosedenotation is stable over the actions of the rely and guaranteeconditions for a reference and its data will not be invalidated byany action through any alias. We demonstrate this with refinement(subset) types that may depend on mutable data. As a specialcase, we derive the first reference immutability type system withdependent types over immutable data.We show soundness for our approach and describe experienceusing rely-guarantee references in a dependently-typed monadicDSL in COQ.
منابع مشابه
Enhancing the usability of rely-guarantee conditions for atomicity refinement
Formal methods are a useful tool for increasing the confidence in the correctness of computer programs with respect to their specifications. Formal methods allow designers to model specifications and these formal models can then be reasoned about in a rigourous way. Formal methods for sequential processes are well-understood, however formal methods for concurrent programs are more difficult, be...
متن کاملReasoning about concurrent programs : Refining rely - guarantee thinking
Interference is the essence of concurrency and it is what makes reasoning about concurrent programs difficult. The fundamental insight of rely-guarantee thinking is that stepwise design of concurrent programs can only be compositional in development methods that offer ways to record and reason about interference. In this way of thinking, a rely relation records assumptions about the behaviour o...
متن کاملConcurrent Refinement Algebra and Rely Quotients
The concurrent refinement algebra developed here is designed to provide a foundation for rely/guarantee reasoning about concurrent programs. The algebra builds on a complete lattice of commands by providing sequential composition, parallel composition and a novel weak conjunction operator. The weak conjunction operator coincides with the lattice supremum providing its arguments are non-aborting...
متن کاملRefining rely-guarantee thinking
Reasoning about concurrent programs can be very difficult due to the possibility of interference. The fundamental insight of Rely-Guarantee thinking is that developing concurrent designs can only be made compositional if the development method offers ways to record and reason about the interference that is inherent in concurrency. The original presentation of rely-guarantee rules used keywords ...
متن کاملThe Re-entrance Problem and Its Solution
In this paper we take a formal look at the nature of the re-entrance problem. We see the essence of the problem in a conflict between the assumptions components make about each other’s behavior. We argue that to ensure safe composability of mutually dependent components in an open system one needs to reason about them modularly. We propose an approach for extending component specifications with...
متن کامل